package net.osweb.core.tools.utils.crm;

import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class PropUtil {
	protected static final Log logger = LogFactory.getLog("PropUtil>>");
	private static PropertyResourceBundle propBundle = (PropertyResourceBundle) ResourceBundle
	.getBundle("blog");
	
	public static String getWebSuffix()
	{
		return propBundle.getString("web_app_suffix");
	}
	public static String getTmpUploadPath()
	{
		return propBundle.getString("tmp_uplaod_path");
	}
	
	public static Integer getUserTagLevel()throws NumberFormatException
	{
		String userTagLevelStr = propBundle.getString("user_tag_level");
		Integer userTagLevel = null;
		if( userTagLevelStr != null ){
			try {
				userTagLevel = Integer.parseInt( propBundle.getString("user_tag_level") );
			} catch (NumberFormatException e) {
				e.printStackTrace();
				logger.error("user tag level format in properties file is wrong.");
				throw e; 
			}
		}

		return userTagLevel;
	}
}
